<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="DBConnection.DB"%>
<%@page import="java.sql.*"%>
<%@page import="JavaBean.PieChart3D"%>
<%@page import="java.io.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>table</title>
		<link href="../../css/layer.css" rel="stylesheet" type="text/css" />
	</head>
				<%
					String totalid = request.getParameter("totalid")
							;
					String[] id = totalid.split(";");
                    String[][]  shuju  = new String[20][5];                    
					DB db = new DB();
					ResultSet rs = null;
					db.ConnectDB();
					int i =0;
					for ( i=0; i < id.length; i++) {
						if (!id[i].equals("")) {
							String[] quyu = id[i].split("@");
							String sql = "select count(*) from  成果   where  ";
							if (quyu[1].equals("city"))
								sql += " 所在市 ='" + quyu[0]+"'";                           
							if (quyu[1].equals("xian"))
								sql += " 所在区县 ='" + quyu[0]+"'";
							rs = db.sm.executeQuery(sql);
							while (rs.next()) {
							    shuju[i][0] = quyu[0];
							    for(int j =1 ; j<=1 ;j++){
							    if( rs.getString(j)!=null && !rs.getString(j).equals("") && !rs.getString(j).equals("null"))
							    shuju[i][j] = rs.getString(j);
							    else
							    shuju[i][j]= "0";
							    }
							}
						}
					}
				%>
	<body>
		<div class="table_list">
			<table class="table1" width="100%" cellpadding="0" cellspacing="0">
				<tr class="tr_bt">
					<td class="td2" width="200px"><strong>
						地理位置</strong>
					</td>
					<%
					for(int k=0; k<i;k++){
					%>
					<td class="td2"><strong>
						<%=shuju[k][0]%></strong>
					</td>
					<%
					}
					 %>
					 </tr>
					 <tr>
					<td class="td2">
						成果总数（个）
					</td>
						<%
					for(int k=0; k<i;k++){
					%>
					<td class="td2">
						<%=shuju[k][1]%>
					</td>
					<%
					}
					 %>
					 </tr>					
				</table>
			</div>
							<%		
							db.CloseDB();
	    String filename = PieChart3D.generateRoChartcgcp(shuju, 600, 375, request
				.getSession(), new PrintWriter("writer"));
		String graphURL = request.getContextPath()
			+ "/Servlet/DisplayChart?filename=" + filename;		
		 %>
		 <p><img src="<%=graphURL%>"></img></p>
		 <script>
		 window.parent.$("#fanhui").hide();
		 </script>
	</body>
</html>
